Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[MIG] date_range: Migrate to version 17.0 #790

Merged
merged 50 commits into from
Jan 8, 2024

Conversation

sonhd91
Copy link

@sonhd91 sonhd91 commented Jan 2, 2024

Based on:

Note:

  • fixed issue active fields feature doesn't worked on date.range.types (doesn't hide it on search view when active set False)

lmignon and others added 30 commits November 26, 2023 10:12
* [ADD] Basic structure for the new date range module

* [IMP] Add a basic description into the README

* [IMP] Basic implementation

* [IMP] First working implementation

* [IMP] Improve datamodel

* [ADD] Add basic tests for date.range

* [PEP8]

* [PYLINT]

* [DEL] Remove unused code

* [IMP] Remove unsused dependencies into the JS

* [IMP] Better operator label for date range

* [DEL] Remove unused file

* [IMP] Better user experience by showing the select input only once empty

* [FIX]Try to fix tests that fails only on travis by adding an explicit cast on the daterange methods parameters

* [FIX]Try to fix tests that fails only on travis by adding an explicit cast on the daterange methods parameters

* [FIX]Try to fix tests that fails only on travis by using postgresql 9.4

* [FIX]Try with postgresql 9.2 since the daterange method has appeared in 9.2

* [IMP] Add a limitation into the module description to warm about the minimal version of postgresql to use

* [IMP]Add multi-company rules

* [IMP]Remove unused files

* [FIX] Add missing brackets into JS

* [FIX] Overlap detection when company_id is False

* [IMP] Add default order for date.range

* [IMP] Add date range generator

* [FIX] OE compatibility

* [FIX] Travis

* [IMP] Code cleanup and improves test coverage

* [FIX] Add missing dependency on 'web'

* [PYLINT] remove unused import

* [FIX] Add missing copyright

* [FIX] Limits are included into the range

* [IMP][date_range] Security

* [IMP] Improve module description

* [IMP] Spelling
* Improve 'name' for generator wizard

  ir.rule should be active by default
* Don't auto-add '-' after prefix when generating date ranges via wizard
* code fine tuning suggested by Sylvain Garancher
If any module adds a required field on company, module fails. Executing it on
post_install, there's no problem.
Pylint-odoo is not able to detect properly whitelisted odoo's dependencies if an isort configuration file is present into the directory. Therefore the check fails by complaining that the dateutil dependecy is not declared into the manifest. A fix could have been to declare the dependency into the manifest . Unfortunately, in this case, a warning will be issued by runbot complaining that the python external dependency dateutil should be replaced by it's PyPI package name. Unfortunalely, if we put the Pypi package name into the external dependencies, pylint fails again since it's not able to play with PyPI distribution names.
The workaround is to temporarily disable this check into pylint. I every case, all the pre-commit files will be reset once pylint will be fixed
We can't assign an empty recordset in a computed writable for a required field for
triggering DB fault, as previously this we get an akward error no in current
ORM status:

ERROR: operator does not exist: integer = boolean
LINE 12:                     AND dt.type_id=false;
                                           ^
HINT:  No operator matches the given name and argument types. You might need to add explicit type casts.

so let's simply trigger in this case the check of the company consistency, which is
legit and the final expected result.

I have added an extra test for testing the company consistency the other way around.
Because ev.target.value is a string and the range ids are integers,
comparison was always false, so the first range values were always used.
@gurneyalex
Copy link
Member

/ocabot migration date_range

@OCA-git-bot OCA-git-bot added this to the 17.0 milestone Jan 2, 2024
@gurneyalex
Copy link
Member

/ocabot merge nobump

@OCA-git-bot
Copy link
Contributor

This PR looks fantastic, let's merge it!
Prepared branch 17.0-ocabot-merge-pr-790-by-gurneyalex-bump-nobump, awaiting test results.

OCA-git-bot added a commit that referenced this pull request Jan 8, 2024
Signed-off-by gurneyalex
@OCA-git-bot
Copy link
Contributor

@gurneyalex The merge process could not be finalized, because command oca-gen-addon-readme --if-source-changed --org-name OCA --repo-name server-ux --branch 17.0 --addons-dir /tmp/tmpjro8b74c --commit failed with output:

/tmp/tmpjro8b74c/date_range/README.rst:127: (ERROR/3) Duplicate substitution definition name: "image1".
Traceback (most recent call last):
  File "/usr/local/bin/oca-gen-addon-readme", line 11, in <module>
    load_entry_point('oca-maintainers-tools', 'console_scripts', 'oca-gen-addon-readme')()
  File "/ocamt/lib/python3.8/site-packages/click/core.py", line 1157, in __call__
    return self.main(*args, **kwargs)
  File "/ocamt/lib/python3.8/site-packages/click/core.py", line 1078, in main
    rv = self.invoke(ctx)
  File "/ocamt/lib/python3.8/site-packages/click/core.py", line 1434, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/ocamt/lib/python3.8/site-packages/click/core.py", line 783, in invoke
    return __callback(*args, **kwargs)
  File "/ocamt/src/oca-maintainers-tools/tools/gen_addon_readme.py", line 575, in gen_addon_readme
    check_rst(readme_filename)
  File "/ocamt/src/oca-maintainers-tools/tools/gen_addon_readme.py", line 398, in check_rst
    publish_file(
  File "/ocamt/lib/python3.8/site-packages/docutils/core.py", line 422, in publish_file
    output, publisher = publish_programmatically(
  File "/ocamt/lib/python3.8/site-packages/docutils/core.py", line 722, in publish_programmatically
    output = publisher.publish(enable_exit_status=enable_exit_status)
  File "/ocamt/lib/python3.8/site-packages/docutils/core.py", line 234, in publish
    self.document = self.reader.read(self.source, self.parser,
  File "/ocamt/lib/python3.8/site-packages/docutils/readers/__init__.py", line 70, in read
    self.parse()
  File "/ocamt/lib/python3.8/site-packages/docutils/readers/__init__.py", line 76, in parse
    self.parser.parse(self.input, document)
  File "/ocamt/lib/python3.8/site-packages/docutils/parsers/rst/__init__.py", line 184, in parse
    self.statemachine.run(inputlines, document, inliner=self.inliner)
  File "/ocamt/lib/python3.8/site-packages/docutils/parsers/rst/states.py", line 169, in run
    results = StateMachineWS.run(self, input_lines, input_offset,
  File "/ocamt/lib/python3.8/site-packages/docutils/statemachine.py", line 233, in run
    context, next_state, result = self.check_line(
  File "/ocamt/lib/python3.8/site-packages/docutils/statemachine.py", line 445, in check_line
    return method(match, context, next_state)
  File "/ocamt/lib/python3.8/site-packages/docutils/parsers/rst/states.py", line 3024, in text
    self.section(title.lstrip(), source, style, lineno + 1, messages)
  File "/ocamt/lib/python3.8/site-packages/docutils/parsers/rst/states.py", line 325, in section
    self.new_subsection(title, lineno, messages)
  File "/ocamt/lib/python3.8/site-packages/docutils/parsers/rst/states.py", line 391, in new_subsection
    newabsoffset = self.nested_parse(
  File "/ocamt/lib/python3.8/site-packages/docutils/parsers/rst/states.py", line 279, in nested_parse
    state_machine.run(block, input_offset, memo=self.memo,
  File "/ocamt/lib/python3.8/site-packages/docutils/parsers/rst/states.py", line 195, in run
    results = StateMachineWS.run(self, input_lines, input_offset)
  File "/ocamt/lib/python3.8/site-packages/docutils/statemachine.py", line 233, in run
    context, next_state, result = self.check_line(
  File "/ocamt/lib/python3.8/site-packages/docutils/statemachine.py", line 445, in check_line
    return method(match, context, next_state)
  File "/ocamt/lib/python3.8/site-packages/docutils/parsers/rst/states.py", line 2785, in underline
    self.section(title, source, style, lineno - 1, messages)
  File "/ocamt/lib/python3.8/site-packages/docutils/parsers/rst/states.py", line 325, in section
    self.new_subsection(title, lineno, messages)
  File "/ocamt/lib/python3.8/site-packages/docutils/parsers/rst/states.py", line 391, in new_subsection
    newabsoffset = self.nested_parse(
  File "/ocamt/lib/python3.8/site-packages/docutils/parsers/rst/states.py", line 279, in nested_parse
    state_machine.run(block, input_offset, memo=self.memo,
  File "/ocamt/lib/python3.8/site-packages/docutils/parsers/rst/states.py", line 195, in run
    results = StateMachineWS.run(self, input_lines, input_offset)
  File "/ocamt/lib/python3.8/site-packages/docutils/statemachine.py", line 233, in run
    context, next_state, result = self.check_line(
  File "/ocamt/lib/python3.8/site-packages/docutils/statemachine.py", line 445, in check_line
    return method(match, context, next_state)
  File "/ocamt/lib/python3.8/site-packages/docutils/parsers/rst/states.py", line 2355, in explicit_markup
    nodelist, blank_finish = self.explicit_construct(match)
  File "/ocamt/lib/python3.8/site-packages/docutils/parsers/rst/states.py", line 2367, in explicit_construct
    return method(self, expmatch)
  File "/ocamt/lib/python3.8/site-packages/docutils/parsers/rst/states.py", line 2085, in substitution_def
    self.document.note_substitution_def(
  File "/ocamt/lib/python3.8/site-packages/docutils/nodes.py", line 1550, in note_substitution_def
    msg = self.reporter.error(
  File "/ocamt/lib/python3.8/site-packages/docutils/utils/__init__.py", line 231, in error
    return self.system_message(self.ERROR_LEVEL, *args, **kwargs)
  File "/ocamt/lib/python3.8/site-packages/docutils/utils/__init__.py", line 197, in system_message
    raise SystemMessage(msg, level)
docutils.utils.SystemMessage: /tmp/tmpjro8b74c/date_range/README.rst:127: (ERROR/3) Duplicate substitution definition name: "image1".

@pedrobaeza
Copy link
Member

Wrong readme fragment defining 2 times an image with the same name it seems. Not sure if something of the automatic conversion or copy/paste thing.

@sonhd91
Copy link
Author

sonhd91 commented Jan 8, 2024

Wrong readme fragment defining 2 times an image with the same name it seems. Not sure if something of the automatic conversion or copy/paste thing.

I just updated image name to avoid duplicate subname error

@gurneyalex
Copy link
Member

/ocabot merge nobump

@OCA-git-bot
Copy link
Contributor

What a great day to merge this nice PR. Let's do it!
Prepared branch 17.0-ocabot-merge-pr-790-by-gurneyalex-bump-nobump, awaiting test results.

@OCA-git-bot OCA-git-bot merged commit a038adc into OCA:17.0 Jan 8, 2024
7 checks passed
@OCA-git-bot
Copy link
Contributor

Congratulations, your PR was merged at b4dbe0a. Thanks a lot for contributing to OCA. ❤️

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.